package com.market.controller.admin;

import com.market.bean.MarketKeyword;
import com.market.bean.common.BasePageInfo;
import com.market.bean.common.BaseRespVo;
import com.market.bean.common.CommonData;
import com.market.service.admin.AdminKeywordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author fan
 * @Description:
 * @since 2022/12/30 21:36
 */
@RestController
@RequestMapping("admin/keyword")
public class AdminKeywordController {
    @Autowired
    AdminKeywordService keywordService;

    @GetMapping("list")
    public BaseRespVo list(BasePageInfo info, String keyword, String  url) {
        CommonData<MarketKeyword> data = keywordService.list(info, keyword,url);
        return BaseRespVo.ok(data);
    }

    @PostMapping("create")
    public BaseRespVo create(@RequestBody  MarketKeyword keyword) {
        MarketKeyword data = keywordService.create(keyword);
        return BaseRespVo.ok(data);
    }

    @PostMapping("update")
    public BaseRespVo update(@RequestBody  MarketKeyword keyword) {
        MarketKeyword data = keywordService.update(keyword);
        return BaseRespVo.ok(data);
    }

    @PostMapping("delete")
    public BaseRespVo delete(@RequestBody MarketKeyword keyword) {
        keywordService.delete(keyword);
        return BaseRespVo.ok();
    }


}
